/* eslint-disable camelcase,import/first,import/no-duplicates */
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
import axios from 'axios'
Vue.prototype.$http = axios
const help = () =>import('@/pages/help')// 帮助页面
const Sales = () => import('@/components/Sales')// 销售业绩
const Team= () =>import('@/components/Team') // 我的团队
const myOrder = () =>import('@/components/myOrder')// 我的订单
const newMembers = () =>import('@/components/newMembers')// 新成员
const fxLogin = () =>import('@/components/login')// 分销  登录
const fxRegister = () =>import('@/components/fxregister')// 分销注册
const fxRegisterCode = () =>import('@/components/fxRegisterCode')// 验证
const myCollect = () =>import('@/components/myCollect')// 地址
const Shopping = () =>import('@/components/Shopping') // 购物车
const fxpdDetails = () =>import( '@/components/fxpdDetails')
const MemberContainer = () =>import('@/pages/MemberContainer')// 分销 分类首页
const MemberList = () =>import('@/pages/MemberList')// 分销 分类2
const Shops = () =>import('@/pages/Shops')// 分销 商铺首页
const NewShopslist = () =>import('@/pages/NewShopslist')// 新建商铺2
const XGShops = () =>import('@/pages/XGShops')// 新建商铺2
const Invitation = () =>import('@/pages/Invitation')// 个人信息
const ModifyPhone = () =>import('@/pages/ModifyPhone')// 修改手机号
const ModifyPhoneNext = () =>import( '@/pages/ModifyPhoneNext')// 修改手机号下一步
const newPassword = () =>import('@/pages/newPassword')// 修改密码
const GoodsDetail = () =>import('@/pages/GoodsDetail/GoodsDetail')// 商品详情
const FXGoodsDetail = () =>import('@/pages/GoodsDetail/FXGoodsDetail')// 商品详情
const NewShop = () =>import('@/pages/NewShop')// 新建商店1
const Collage = () =>import('@/pages/Collage/Collage')// 拼单确认
const Brand = () =>import('@/pages/Brand/Brand')// 品牌精选
const BrandDetail = () =>import('@/pages/Brand/BrandDetail')// 品牌精选详情页
const TransactionRecord = () =>import('@/pages/TransactionRecord')// 交易记录
const myHomeFX = () =>import('@/pages/myHomeFX')// 分销商 我的
const Messages = () =>import('@/pages/Messages/Messages')// 消息
const  Shopping_T= () =>import('@/pages/Shopping_T') // 订单确认
const Management = () =>import('@/pages/Management/Management')// 商品管理
const PinDetail = () =>import('@/pages/GoodsDetail/PinGoodsDetail')
const teamOrder = () =>import('@/components/teamOrder')//团单全部
const teamOrdering = () =>import('@/components/teamOrdering')//拼单中
const teamOrdersuccess = () =>import('@/components/teamOrdersuccess')//拼单成功
const teamOrderReturn = () =>import('@/components/teamOrderReturn')//退货售后
const personalOrder = () =>import('@/components/personalOrder')
const disTrueHome = () =>import('@/components/disTrueHome')
const Ranking = () =>import('@/components/Ranking')
const Speciale = () =>import('@/components/Speciale')
const Rules = () =>import('@/components/Rules')
const SpecialTx = () =>import('@/components/SpecialTx')
const myOrderAll = () =>import('@/components/myorders/myOrderAll')// 用户订单全部
const myOrderIng = () =>import('@/components/myorders/myOrderIng')// 用户订单拼单中
const myOrderWaiting = () =>import('@/components/myorders/myOrderWaiting')// 用户订单待发
const myOrderAlready = () =>import('@/components/myorders/myOrderAlready')// 用户订单已发
const myOrderReturn = () =>import('@/components/myorders/myOrderReturn')// 用户订单退货
const logistics = () =>import('@/components/logistics')//物流信息
const afterSalesfor= () =>import('@/components/afterSalesfor')//物流信息

// 拼团路由
const login = () =>import('@/pages/login' )// 登录
const codeCheck = () =>import('@/pages/codeCheck')// 验证码
const register = () =>import('@/pages/register') // 注册
const home = () =>import('@/pages/home') // footer导航
const mall = () =>import('@/pages/mall')// 商城
const Follow = () =>import('@/pages/Follow')// 关注店铺
const creditExchange = () =>import('@/pages/creditExchange')// 积分兑换
const myHome = () =>import('@/pages/myHome')// 我的
const homeAllSort = () =>import('@/pages/homeAllSort')// 拼团首页
const pinDanDetails = () =>import('@/pages/pinDanDetails')// 拼单详情
const PinGoodsDetail = () =>import('@/pages/GoodsDetail/PinGoodsDetail')// 商品详情
const Exchange = () =>import('@/pages/Exchange/Exchange')// 订单确认
const FXExchange = () =>import('@/pages/Exchange/FXExchange')
const perInformation = () =>import('@/pages/perInformation')/// 个人信息
const Collect = () =>import('@/pages/Collect/Collect')// 我的收藏
const addressManage = () =>import('@/pages/addressManage')// 地址管理
const addressEdit = () =>import('@/pages/addressEdit') // 编辑地址
const addressCreate = () =>import('@/pages/addressCreate') // 新建地址
const bill = () =>import('@/pages/bill')// 发票管理
const billEdit = () =>import('@/pages/billEdit')// 编辑发票
const billCreate = () =>import('@/pages/billCreate') // 新建发票
const creditCard = () =>import('@/pages/creditCard') // 银行卡管理
const cardEdit = () =>import('@/pages/cardEdit') // 编辑银行卡
const cardCreate = () =>import('@/pages/cardCreate')// 新建银行卡
const shopSet = () =>import('@/pages/shopSet')// 我要开店
const middle = () =>import('@/pages/middle')
const AfterSalesDetail = () => import('@/pages/AfterSalesDetail') // 售后详情
export default new Router({
mode: 'history',
 base:'/dist/',

routes: [
    // 分销商路由：
    // 登录
  {
    path:'/help',
    name:'help',
    component:help,
    meta: {
      title: '帮助'
    }
  },
  {
    path:'/middle',
    name:'middle',
    component:middle
  },
    {
      path: '/fxLogin',
      name: 'fxLogin',
      component: fxLogin,
      meta: {
         title: '登录'
      }
    },
    // 注册
    {
      path: '/fxRegister',
      name: 'fxRegister',
      component: fxRegister,
      meta: {
         title: '注册'
      }
    },
    // 验证
    {
      path: '/fxRegisterCode',
      name: 'fxRegisterCode',
      component: fxRegisterCode,
      meta: {
         title: '验证'
      }
    },
    // 分销商首页

    {
      path: '/disTrueHome',
      name: 'disTrueHome',
      component: disTrueHome,
      meta: {
         title: '首页'
      }
    },

  {
    path: '/afterSalesfor',
    name: 'afterSalesfor',
    component: afterSalesfor,
    meta: {
      title: '售后申请'
    }
  },
    {
      path: '/SpecialTx',
      name: 'SpecialTx',
      component: SpecialTx,
      meta: {
         title: '特选区'
      }
    },
    {
      path: '/Speciale',
      name: 'Speciale',
      component: Speciale,
      meta: {
         title: ''
      }
    },


    {//排行榜
      path: '/Ranking',
      name: 'Ranking',
      component: Ranking,
      meta: {
         title: '排行榜'
      }
    },
    {//提升佣金
      path: '/Rules',
      name: 'Rules',
      component:Rules,
      meta: {
         title: ''
      }
    },

    // 确定订单
    {
      path: '/shopping_T',
      name: 'Shopping_T',
      component: Shopping_T
    },
    // 商品管理
    {
      path: '/management',
      name: 'Management',
      component: Management,
      meta: {
         title: '商品管理'
      }
    },
    // 销售业绩
    {
      path: '/Sales',
      name: 'Sales',
      component: Sales,
      meta: {
         title: '销售业绩'
      }
    },
    // 团队管理
    {
      path: '/Team',
      name: 'Team',
      component: Team,
      meta: {
         title: '团队管理'
      }
    },
    // 分销我的订单
    {
      path: '/myOrder',
      name: 'myOrder',
      component: myOrder,
      meta: {
         title: '我的订单'
      }
    },
    // 分销我的团单全部
    {
      path: '/teamOrder',
      name: 'teamOrder',
      component: teamOrder,
      meta: {
         title: '我的团单'
      }
    },
    // 分销我的拼单中
    {
      path: '/teamOrdering',
      name: 'teamOrdering',
      component: teamOrdering,
      meta: {
        title: '我的团单'
      }
    },
    // 分销我的拼单成功
    {
      path: '/teamOrdersuccess',
      name: 'teamOrdersuccess',
      component: teamOrdersuccess,
      meta: {
        title: '我的团单'
      }
    },
    // 分销退货售后
    {
      path: '/teamOrderReturn',
      name: 'teamOrderReturn',
      component: teamOrderReturn,
      meta: {
        title: '我的团单'
      }
    },

    // 团单详情订单页面
    {
      path: '/personalOrder',
      name: 'personalOrder',
      component: personalOrder,
      meta: {
         title: '团单详情'
      }
    },
    // 添加新成员
    {
      path: '/newMembers',
      name: 'newMembers',
      component: newMembers,
      meta: {
         title: '添加新成员'
      }
    },
    // 分销商我的中的消息页面
    {
      path: '/Messages',
      name: 'Messages',
      component: Messages,
      meta: {
         title: '消息'
      }
    },
  {
    path: '/logistics',
    name: 'logistics',
    component: logistics,
    meta: {
      title: '物流信息'
    }
  },
    // 交易记录
    {
      path: '/transactionRecord',
      name: 'TransactionRecord',
      component: TransactionRecord,
      meta: {
         title: '交易记录'
      }
    },

    // 地址
    {
      path: 'myCollect',
      name: 'myCollect',
      component: myCollect,
      meta: {
         title: '地址'
      }
    },
    // 购物车
    {
      path: '/shopping',
      name: 'Shopping',
      component: Shopping
    },
    // 个人信息
    {
      path: '/Invitation',
      name: 'Invitation',
      component: Invitation,
      meta: {
         title: '个人信息'
      }
    },
    // 修改密码
    {
      path: '/newPassword',
      name: 'newPassword',
      component: newPassword,
      meta: {
         title: '修改密码'
      }
    },
    // 修改手机
    {
      path: '/ModifyPhone',
      name: 'ModifyPhone',
      component: ModifyPhone,
      meta: {
         title: '修改手机'
      }
    },
    // 修改手机2级
    {
      path: '/ModifyPhoneNext',
      name: 'ModifyPhoneNext',
      component: ModifyPhoneNext,
      meta: {
        title: '修改手机'
      }
    },

    // 商铺首页
    {
      path: '/Shops',
      name: 'Shops',
      component: Shops,
      meta: {
         title: '商铺首页'
      }
    },
    {
      path: '/XGShops',
      name: 'XGShops',
      component: XGShops,
      meta: {
         title: '修改店铺信息'
      }
    },
    // 新建店铺
    {
      path: '/newshop',
      name: 'NewShop',
      component: NewShop,
      meta: {
         title: '新建店铺'
      }
    },
    { // 新建商铺2
      path: '/NewShopslist',
      name: 'Newshopslist',
      component: NewShopslist,
      meta: {
        title: '新建店铺'
      }
    },

    // 分类首页
    {
      path: '/MemberContainer',
      name: 'MemberContainer',
      component: MemberContainer,
      meta: {
         title: '分类'
      }
    },
    // 分类2级
    {
      path: '/MemberList',
      name: 'MemberList',
      component: MemberList,
      meta: {
        title: '分类'
      }
    },

    // 品牌精选
    {
      path: '/brand',
      name: 'Brand',
      component: Brand,
      meta: {
         title: '品牌精选'
      }
    },
    // 品牌精选详情页
    {
      path: '/branddetail',
      name: 'BrandDetail',
      component: BrandDetail,
      meta: {
         title: '品牌精选'
      }
    },
    {
      path: '/fxpdDetails',
      name: 'fxpdDetails',
      component: fxpdDetails,
      meta: {
         title: '拼单详情'
      }
    },
    // 商品详情
    {//普通商城  商品详情   需要userId  mallId
      path: '/detail',
      name: 'detail',
      component: GoodsDetail,
      meta: {
         title: '商品详情'
      }
    },
    {// 分销商特选  商品详情  需要userId  mallId
      path: '/fxdetail',
      name: 'FXGoodsDetail',
      component: FXGoodsDetail,
      meta: {
        title: '商品详情'
      }
    },
    {// 拼单商品详情   需要userId  gpId
      path: '/pindetail',
      name: 'PinDetail',
      component: PinDetail,
      meta: {
        title: '商品详情'
      }
    },
    // 订单确认
    {
      path: '/collage',
      name: 'Collage',
      component: Collage,
      meta: {
         title: '订单确认'
      }
    },
    {// 分销商首页 我的
      path: '/myHomeFX',
      name: 'myHomeFX',
      component: myHomeFX,
      meta: {
         title: '我的'
      }
    },
    /**************************************************************************************/
    // 拼团用户路由：
    {// 登录页面
      path: '/login',
      name: 'login',
      component: login,
      meta: {
         title: '登录'
      }
    },
    {// 注册页面
      path: '/register',
      name: 'register',
      component: register,
      meta: {
         title: '注册'
      }
    },
    {// 忘记密码：验证码登录，修改密码
      path: '/codeCheck',
      name: 'codeCheck',
      component: codeCheck,
      meta: {
         title: '注册'
      }
    },
    { // 拼单商品详情
      path: '/PinGoodsDetail',
      name: 'PinGoodsDetail',
      component: PinGoodsDetail,
      meta: {
        title: '拼单商品详情'
      }
    },
    {// 订单确认
      path: '/exchange',
      name: 'Exchange',
      component: Exchange,
      meta: {
        title: '订单确认'
      }
    },
    {
      path: '/fxexchange',
      name: 'FXExchange',
      component: FXExchange,
      meta: {
        title: '订单确认'
      }
    },
    { // 拼单详情
      // 不能将此组件放在首页children下，否则会在首页的router-view中显示，而不是一个单独的页面
      path: '/pinDanDetails',
      name: 'pinDanDetails',
      component: pinDanDetails,
      meta: {
         title: '拼单详情'
      }
    },
    // {// 订单
    //   path: '/myOrder',
    //   name: 'myOrder',
    //   component: myOrder
    // },
    {// 我的收藏
      path: '/Collect',
      name: 'Collect',
      component: Collect
    },
    // {// 消息页面
    //   path: '/Messages',
    //   name: 'Messages',
    //   component: Messages
    // },
    {// 地址管理
      path: '/addressManage',
      name: 'addressManage',
      component: addressManage,
      meta: {
         title: '地址管理'
      }
    },
    {// 编辑地址
      path: '/addressEdit',
      name: 'addressEdit',
      component: addressEdit,
      meta: {
        title: '编辑地址'
      }
    },
    {// 新建地址
      path: '/addressCreate',
      name: 'addressCreate',
      component: addressCreate,
      meta: {
         title: '新建地址'
      }
    },
    {// 发票管理
      path: '/bill',
      name: 'bill',
      component: bill,
      meta: {
         title: '发票管理'
      }
    },
    {// 编辑发票
      path: '/billEdit',
      name: 'billEdit',
      component: billEdit,
      meta: {
         title: '编辑发票'
      }
    },
    {// 新建发票
      path: '/billCreate',
      name: 'billCreate',
      component: billCreate,
      meta: {
         title: '新建发票'
      }
    },
    {// 银行卡管理
      path: '/creditCard',
      name: 'creditCard',
      component: creditCard
    },
    {// 编辑银行卡
      path: '/cardEdit',
      name: 'cardEdit',
      component: cardEdit
    },
    {// 新建银行卡
      path: '/cardCreate',
      name: 'cardCreate',
      component: cardCreate
    },
    {// 我要开店
      path: '/shopSet',
      name: 'shopSet',
      component: shopSet,
      meta: {
         title: '我要开店'
      }
    },
   {// 个人信息
      path: '/perInformation',
      name: 'perInformation',
      component: perInformation,
     meta: {
        title: '个人信息'
     }
    },
    { //用户订单全部
      path: '/myOrderAll',
      name: 'myOrderAll',
      component: myOrderAll,
      meta: {
         title: '订单'
      }
    },
    { //用户拼单中
      path: '/myOrderIng',
      name: 'myOrderIng',
      component: myOrderIng,
      meta: {
        title: '订单'
      }
    },
    { //用户订单待发
      path: '/myOrderWaiting',
      name: 'myOrderWaiting',
      component: myOrderWaiting,
      meta: {
        title: '订单'
      }
    },
    { //用户订单已发
      path: '/myOrderAlready',
      name: 'myOrderAlready',
      component: myOrderAlready,
      meta: {
        title: '订单'
      }
    },
    { //用户订单退货
      path: '/myOrderReturn',
      name: 'myOrderReturn',
      component: myOrderReturn,
      meta: {
        title: '订单'
      }
    },
    { // 首页 全部分类
      path: '/homeAllSort',
      name: 'homeAllSort',
      component: homeAllSort,
      meta: {
        title: '店铺首页'
      }
    },
    {// 首页
      path: '/',
      name: 'home',
      component: home,
      redirect: '/mall',
      children: [
        {// 商城首页
          path: 'mall',
          name: 'mall',
          component: mall,
          meta: {
            title: '首页'
          }
        },
        {// 关注店铺
          path: 'Follow',
          name: 'Follow',
          component: Follow,
          meta: {
            title: '关注店铺'
          }
        },
        { // 积分兑换
          path: 'creditExchange',
          name: 'creditExchange',
          component: creditExchange,
          meta: {
             title: '积分兑换'
          }
        },
        { // 我的
          path: 'myHome',
          name: 'myHome',
          component: myHome,
          meta: {
             title: '我的'
          }
        },
        {
          path:'AfterSalesDetail',
          name:'AfterSalesDetail',
          component:AfterSalesDetail,
          meta:{
            title:'售后详情'
          }
        }


      ]
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop;
      }
      return { x: 0, y: to.meta.savedPosition || 0 }
    }
  }
})
